<!DOCTYPE html>
<html>
<head>
    <title>充值大抽奖</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no, maximum-scale=1.0"/>
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link href="../assets/mobile/comm.css" rel="stylesheet" type="text/css" />
	<link href="../assets/mobile/member.css" rel="stylesheet" type="text/css" />
	<script src="../assets/js/mobile/jquery190.js" type="text/javascript"></script>
	<link href="../assets/mobile/help.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" href="../assets/mobile/top.css">
	<link rel="stylesheet" href="../assets/agile/css/ratchet/css/ratchet.min.css">
	<link rel="stylesheet" href="../assets/agile/css/flat/flat.component.css">
	<link rel="stylesheet" href="../assets/agile/css/flat/iconline.css">
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript" src="../script/local.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
</head>
<body style="position:static;">
<div class="h5-1yyg-v11">
<!--通用顶部-->
<div id="ios-top-box">
    <div id="header" class="bar bar-nav">
    <div class="titlebar">
    <a href="javascript:appClose('lottery',api);"><i class="iconfont iconline-arrow-left"></i></a>
    <h1 class="title">积分抽奖</h1>
    </div>
    </div>
</div>
<!--通用顶部结束-->
<style>
    .helpCon{
    	background:inherit;
    	padding: 0;
    	padding-bottom:10px;
    }
	#lottery {
		margin: 0 auto;
		width: 200px;
		height: 200px;
	}
	#lottery .arrow {
		height: 110px;
		width: 18px;
		background: url("../image/lottery/arrow-mobile.png") no-repeat scroll 0 0 transparent;
		top: 22px;
		left: 90px;
		position: relative;
	}
	#lottery .image{
		width: 200px;
		height: 200px;
		position: absolute;
	}
	#lottery #lot-btn {
		height: 50px;
		width: 50px;
		overflow: hidden;
		position: relative;
		top: -34px;
		left: 74px;
	}
	#lottery #lot-btn span {
		cursor: pointer;
		display: block;
		height: 50px;
		position: relative;
		width: 50px;
	}
	#lottery .first span {
		background: url("../image/lottery/buttons_01-mobile.png") no-repeat scroll 0 0 transparent;
	}
	#lottery_tips{
		border-top: 1px solid #eee;
		color: red;
		text-align: center;
		padding: 10px;
	}
	#newList{
		max-height: 140px;
		overflow: hidden;
	}

	span.z-Recharge-btn{
		float: right;
		font-size: 12px;
	}
	</style>
	
    <section class="clearfix g-member" style="margin-top:44px;">

	    <div class="helpCon">
    	    <div class="helpMain m-round">
        	    <div class="helpInfo">
            	    <dt>
                	    <h3>
							100%中奖
							<span class="z-Recharge-btn">
								<a href="javascript:randomSwitchBtn('userrecharge',api);" class="z-Recharge-btn re" style="padding:5px 10px;display:none;">充值</a>
								<a href="javascript:randomSwitchBtn('login',api);" class="z-Recharge-btn login" style="padding:5px 10px;display:none;">登录</a>
							</span>
						</h3>
                    </dt>
                    <dd class="helpBox">
						<div id="lottery">
							<img id="imgs" src="../image/lottery/disc-rotate.gif" class="image">
							<div class="arrow"></div>
							<div class="first" id="lot-btn">
								<span></span>
							</div>
						</div>
                    </dd>
                    <dd class="helpBox" id="lottery_tips">						
						<p class="p1" style="display:none;">您还没有<a class="blue" href="javascript:randomSwitchBtn('login',api);">登录</a>，无法参与抽奖哦</p>
						<p class="p2" style="display:none;">您拥有的福分足够抽奖啦！</p>
						<p class="p3" style="display:none;">抱歉，您还没有抽奖机会快去赚福分吧！</p>
						<p class="p4" style="display:none;">抱歉，您的抽奖次数用完了。</p>
                    </dd>
                </div>
			</div>
		</div>

	    <div class="helpCon">
    	    <div class="helpMain m-round">
        	    <div class="helpInfo">
            	    <dt>
                	    <h3 style="">最新抽奖</h3>
                    </dt>
                    <dd class="helpBox" id="newList">
						<ul>加载中...</ul>
                    </dd>
                </div>
			</div>
		</div>

	    <div class="helpCon">
    	    <div class="helpMain m-round">
        	    <div class="helpInfo">
            	    <dt>
                	    <h3 style="">活动规则</h3>
                    </dt>
                    <dd class="helpBox">
						1. 活动时间: 2015/12/31 - 2016/9/30<br>
						2. 活动内容：在活动时间内，所有注册会员购买商品，做任务得到福分满1000获得一次抽奖机会哦！<br>
						3. 活动奖品：<br>
							&nbsp; &nbsp; 一等奖: <b class="orange">10元</b> 夺宝红包<br>
							&nbsp; &nbsp; 二等奖: <b class="orange">8元</b> 夺宝红包<br>
							&nbsp; &nbsp; 三等奖: <b class="orange">6元</b> 夺宝红包<br>
							&nbsp; &nbsp; 四等奖: <b class="orange">4元</b> 夺宝红包<br>
							&nbsp; &nbsp; 五等奖: <b class="orange">3元</b> 夺宝红包<br>
							&nbsp; &nbsp; 六等奖: <b class="orange">2元</b> 夺宝红包<br>
							&nbsp; &nbsp; 七等奖: <b class="orange">1元</b> 夺宝红包。<br>
						4. 活动说明：活动中奖率<b class="orange">100%</b>，用户获奖后夺宝红包将直接充值至用户余额内，红包金额不得提现。<br>
						5. 对于查实的作弊行为，扣除一切红包金额，取消抽奖资格。借助网站漏洞或其他平台，恶意获取红包，一经查实将扣除用户所有红包金额，所获商品按作废处理。
                    </dd>
                </div>
			</div>
		</div>
    </section>

<script type="text/javascript" src="../script/jQueryRotate.js"></script>
<script src="../assets/js/mobile/BottomFun.js" type="text/javascript"></script>
<script type="text/javascript">
var Base={head:document.getElementsByTagName("head")[0]||document.documentElement,Myload:function(B,A){this.done=false;B.onload=B.onreadystatechange=function(){if(!this.done&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){this.done=true;A();B.onload=B.onreadystatechange=null;if(this.head&&B.parentNode){this.head.removeChild(B)}}}},getScript:function(A,C){var B=function(){};if(C!=undefined){B=C}var D=document.createElement("script");D.setAttribute("language","javascript");D.setAttribute("type","text/javascript");D.setAttribute("src",A);this.head.appendChild(D);this.Myload(D,B)},getStyle:function(A,B){var B=function(){};if(callBack!=undefined){B=callBack}var C=document.createElement("link");C.setAttribute("type","text/css");C.setAttribute("rel","stylesheet");C.setAttribute("href",A);this.head.appendChild(C);this.Myload(C,B)}};
GetJPData(config.url+'/app.php?act=turntable',{},function(data){
    if(data['status']){
        $('.re').show();
        $('.login').hide();
        var html = '';
        for(var i in data['data']){
            html += '<li>【<b class="orange">'+data['data'][i]['username']+'</b>】 抽中<b class="orange">'+data['data'][i]['title']+'</b>，获得<b class="orange">'+data['data'][i]['desc']+'</b></li>';
        }
        $('#newList').html(html);
    }
});

$(function(){
        var isRunning = false;
        $("#lot-btn").click(function() {
            
            var userinfo = '';
            if (!(userinfo = getUserinfo())){
                        $('.re').hide();
                $('.login').show();
                $.PageDialog.fail('您还没有登录，无法参与抽奖哦');
                return;
            }
            
            if (isRunning) {
                return;
            }
            $('#imgs').rotate(0);
            $.ajax({
                type : 'post',
                url: config.url+"/app.php?act=submit&tm="+(new Date()).getTime(),
                data : {uid:userinfo.uid},
                beforeSend: function(){
                    isRunning = true;
                    $("#imgs").rotate({
                        animateTo: 360*30,
                        duration: 20000,
                        callback: function(){
                            $.PageDialog.fail('哎呀，没有抽中，再接再厉！');
                            isRunning = false;
                        }
                    });
                },
                success: function(data){
                    if ( !data.ok ) {
                        $('#imgs').stopRotate();
                        $("#imgs").rotate({
                            animateTo: 360*6,
                            duration: 5000,
                            callback: function(){
                                $('#lottery_tips p.p4').text(data.desc);
                                $.PageDialog.fail(data.desc);
                                isRunning = false;
                            }
                        });
                    } else {
                        $('#imgs').stopRotate();
                        $("#imgs").rotate({
                            animateTo: 360*6 + Number(data.round),
                            duration: 5000,
                            callback: function(){
                                if ( data.left <=0 ) {
                                    $('#lottery_tips p.p4').text('抱歉，您的抽奖次数用完了。');
                                } else {
                                    $('#lottery_tips p.p2').text('您拥有的福分足够抽奖啦！').show();
                                }
                                isRunning = false;
                                $.PageDialog.fail(data.desc);
                            }
                        });
                    }

                }

            });
        });

    function startmarquee(lh, speed, delay) {
        var t;
        var p = false;
        var o = document.getElementById("newList");
        o.innerHTML += o.innerHTML;
        o.scrollTop = 0;

        function start() {
            t = setInterval(scrolling, speed);
            if (!p) {
                o.scrollTop += 1;
            }
        }

        function scrolling() {
            if (o.scrollTop % lh != 0) {
                o.scrollTop += 1;
                if (o.scrollTop >= o.scrollHeight / 2) o.scrollTop = 0;
            } else {
                clearInterval(t);
                setTimeout(start, delay);
            }
        }
        setTimeout(start, delay);
    }
    startmarquee(25, 30, 0, 1);
});
</script>
</div>
</body>
</html>